﻿<Window x:Class="WpfStudy.StudyItemsControl"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="StudyItemsControl" Height="300" Width="300">
    <Window.Resources>
        <DataTemplate x:Key="comboxDataTemplate">
            <Grid Background="White">
                <Border CornerRadius="5" BorderThickness="2" BorderBrush="Red">
                    <StackPanel Orientation="Vertical">
                        <TextBlock Text="{Binding Name}" FontWeight="Bold"></TextBlock>
                        <TextBlock Text="{Binding Phone}"></TextBlock>
                    </StackPanel>
                </Border>
            </Grid>
        </DataTemplate>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>

        <ComboBox Name="cbData" Grid.Row="0" Height="28" Width="150" ItemTemplate="{StaticResource comboxDataTemplate}">
            <ComboBox.ItemContainerStyle>
                <Style>
                    <Setter Property="ComboBoxItem.Background" Value="White"></Setter>
                    <Style.Triggers>
                        <Trigger Property="ComboBoxItem.IsSelected" Value="True">
                            <Setter Property="ComboBoxItem.Background" Value="White"></Setter>
                            <Setter Property="ComboBoxItem.Foreground" Value="Yellow"></Setter>
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </ComboBox.ItemContainerStyle>
            
            <ComboBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <VirtualizingStackPanel></VirtualizingStackPanel>
                </ItemsPanelTemplate>
            </ComboBox.ItemsPanel>
        </ComboBox>
        <Button Content="LoadData" Grid.Row="1" Name="btnLoadData" Height="25" Width="100" Margin="10" Click="btnLoadData_Click_1"></Button>
    </Grid>
</Window>
